package com.lekang.system.domain;

import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.lekang.common.annotation.Excel;
import com.lekang.common.core.domain.BaseEntity;

/**
 * 床位对象 bed
 *
 * @author zhihao
 * @date 2025-10-13
 */
@Data
public class Bed extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键ID（数据库字段） */
    private Long id;

    /** 床位号（数据库字段） */
    @Excel(name = "床位号")
    private String bedNo;

    /** 房间外键编号（数据库字段） */
    @Excel(name = "房间外键编号")
    private Long roomId;

    /** 状态(0:空闲 1:已占用)（数据库字段） */
    @Excel(name = "状态(0:空闲 1:已占用)")
    private Long status;

    /** 逻辑删除（数据库字段） */
    @Excel(name = "逻辑删除")
    private Long isDeleted;

    /** 额外字段1（数据库字段） */
    @Excel(name = "额外字段1")
    private String extraField1;

    /** 额外字段2（数据库字段） */
    @Excel(name = "额外字段2")
    private String extraField2;

    // ===================== 新增内存级关联字段（无数据库对应字段）=====================
    /** 关联：当前床位归属的房间（多对1） */
    private Room room;
    /** 关联：当前床位对应的老人（1对1，仅当床位已占用时有效） */
    private Elderly elderly;
    // =============================================================================

    // 原有getter/setter（略，保持不变）
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public String getBedNo() { return bedNo; }
    public void setBedNo(String bedNo) { this.bedNo = bedNo; }
    public Long getRoomId() { return roomId; }
    public void setRoomId(Long roomId) { this.roomId = roomId; }
    public Long getStatus() { return status; }
    public void setStatus(Long status) { this.status = status; }
    public Long getIsDeleted() { return isDeleted; }
    public void setIsDeleted(Long isDeleted) { this.isDeleted = isDeleted; }
    public String getExtraField1() { return extraField1; }
    public void setExtraField1(String extraField1) { this.extraField1 = extraField1; }
    public String getExtraField2() { return extraField2; }
    public void setExtraField2(String extraField2) { this.extraField2 = extraField2; }

    // ===================== 关联字段的getter/setter =====================
    public Room getRoom() { return room; }
    public void setRoom(Room room) { this.room = room; }
    public Elderly getElderly() { return elderly; }
    public void setElderly(Elderly elderly) { this.elderly = elderly; }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("bedNo", getBedNo())
                .append("roomId", getRoomId())
                .append("status", getStatus())
                .append("isDeleted", getIsDeleted())
                .append("extraField1", getExtraField1())
                .append("extraField2", getExtraField2())
                .append("room", getRoom()) // 补充关联字段打印
                .append("elderly", getElderly()) // 补充关联字段打印
                .toString();
    }
}